/**
 * 有一分数序列：2/1，3/2，5/3，8/5，13/8，21/13...求出这个数列的前20项之和。
*/
#if  1
#include <stdio.h>
int main()
{
    int denominator[21] = {0};//分母
    int molecule[20] = {0};//分子
    float sum[20] = {0.0};
    int a = 1;
    int b = 1;
    int c = 1;
    int d = 0;
    for (int i = 0; i < 20; i++)
    {
        molecule[i] = a + b;
        b = a;
        a = molecule[i];
        

        denominator[i] = c + d;
        d = c;
        c = denominator[i];
        
    }

    
    for (int i = 0; i < 20; i++)
    {
        /* code */
        sum[i] =  (float)molecule[i] / denominator[i];
    }
    for (int  i = 0; i < 19; i++)
    {
        /* code */
        sum[20] += sum[i];
    }
    printf("%f",sum[20]);
    
    


    return 0;
}
#endif